<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>zfweb</title>
	<link rel="stylesheet" type="text/css" href="zfweb.css">
</head>
<body>
	<div class="bigbody">
		<div class="head">
			<p>战服投票</p>
		</div>
		<div class="mid">
			<div class="block01">
				<div class="L-block01">
					<span class="bianhao">1</span>
					<div class="xian"></div>
					<div id="picture01">
						<div id="b01">
							<span id="c01">
								<img src="picture/yifu.jpg">
							</span>
						</div>
					</div>
					<div class="wenben">
						<p class="shuoming01">吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦</p>
						<div class="piao"><span class="num01" id="num1">12</span><p class="piaoshu">得票数:</p></div>
						<div class="anniu"><input type="button" class="b1" value="投一票" id="search01"></div>
					</div>
				</div>
				<div class="R-block01">
					<span class="bianhao">2</span>
					<div class="xian"></div>
					<div id="picture02">
						<div id="b02">
							<span id="c02">
								<img src="picture/yifu.jpg">
							</span>
						</div>
					</div>
					<div class="wenben">
						<p class="shuoming01">吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦</p>
						<div class="piao"><span class="num01" id="num02">12</span><p class="piaoshu">得票数:</p></div>
						<div class="anniu"><input type="button" class="b1" value="投一票" id="search02"></div>
					</div>
				</div>
			</div>
		</div>
		<div id="s">
			<div id="i">
				<span id="t">
				<p>某某投了一票</p>
				<p>某某投了一票</p>
				<p>某某投了一票</p>
				<p>某某投了一票</p>
				<p>某某投了一票</p>
				</span>
			</div>
		</div>
		
		
	</div>
</div>
<script type="text/javascript">
//滚动字幕
var speed = 10
var s = document.getElementById("s")
var i = document.getElementById("i")
var t = document.getElementById("t")
var d 
i.appendChild(t.cloneNode(true))
function scroll()
{

     s.scrollLeft += 1
     if(s.scrollLeft >= t.offsetWidth) s.scrollLeft = 0;
}
d = window.setInterval(scroll,speed)
s.onmouseover = function(){window.clearInterval(d)}
s.onmouseout = function(){d = window.setInterval(scroll,speed)}
//图片滚动
	var a = document.getElementById("picture01")
    var b = document.getElementById("b01")
    var c = document.getElementById("c01")
    b01.appendChild(c01.cloneNode(true))
window.onload = change1()
function shijian01() {setInterval(colorLiner,10);
	    var val = 199;
	function colorLiner(){
	if(val >= 0){
	    a.scrollLeft++
	    if(a.scrollLeft >= c.offsetWidth) a.scrollLeft = 0;
	val--;
	}
	}
}
function change1() {
setTimeout("change()",5000);
setTimeout("shijian01()",5000);
}
function change() {
setTimeout("change1()",5000);
setTimeout("shijian01()",5000);
}
//ajax
window.onload = function() {
	var request = new XMLHttpRequest();
	request.open("get", "http://120.27.137.151:8080/api/voter/clothes");
	request.setRequestHeader("Authorization",window.localStorage['res_auth_token'])
	request.send();
	request.onreadystatechange = function() {
		if (request.readyState===4) {
			if (request.status===200) { 
				var data = JSON.parse(request.responseText);
				console.log(data.url)
				console.log(data.id)
				console.log(data.user_id)
				console.log(data.vote)
				
			} else {
				alert("发生错误：" + request.status);
			}
		} 
	}
}
</script>


</body>
</html>